/*
*	(*^。^*) TFrameWork License (*^。^*)
*/

/*
 *  Title :  
 *          
 *  Description :  
 *          
 *          
 *  Date : 
 *
 *  Author : DengPing
 *
 *  Modify : 
 */
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
using Object = UnityEngine.Object;


namespace TFrameWork.Module.ActionEditor
{
    public abstract class CommonTrackStyle<TrackStyle,EventStyle> : TrackStyleBase 
        where TrackStyle : CommonTrackStyle<TrackStyle,EventStyle> ,new() 
        where EventStyle : TrackItemStyleBase ,new()
    {
        /// <summary>
        /// 轨道大小和间距
        /// </summary>
        private const int trackSize = 30;
        private const int childSize = 30;
        
        private const string _fullStyleName = "CommonTrackMenu.uxml";
        private const string _fullMianTrackContent = "MainTrackContent.uxml";

        protected VisualElement Top;
        protected VisualElement Icon;
        protected Label Title;
        protected Button AddButton;
        protected Button FlodButton;

        protected Func<bool> _addChildTrackFunc;
        protected Func<int, bool> _deleteChildTrackFunc;

        protected VisualElement TrackMenuList;

        protected VisualElement Content;
        protected VisualElement ChildContent;
        
        
        protected List<CommonChildTrackBase> _childTrackList = new List<CommonChildTrackBase>();
        
        protected TrackBase _parent;
        
        protected TrackData _data;

        public void Init(VisualElement menuParent, VisualElement contentParent, TrackBase parent,TrackData data, string title,
            Func<bool> addChildTrackFunc, Func<int, bool> deleteChildTrackFunc)
        {
            this.menuParent = menuParent;
            this.contentParent = contentParent;
            this._addChildTrackFunc = addChildTrackFunc;
            this._deleteChildTrackFunc = deleteChildTrackFunc;
            this._parent = parent;
            this._data = data;
            menuRoot = ActionEditorUtility.GetStyleSheet<VisualTreeAsset>(_fullStyleName).Instantiate().Query().ToList()[1];
            Title = menuRoot.Q<Label>(nameof(Title));
            Title.text = title;
            
            Top = menuRoot.Q(nameof(Top));
            Icon = menuRoot.Q(nameof(Icon));
            
            AddButton = menuRoot.Q<Button>(nameof(AddButton));
            AddButton.clicked += () => AddButtonClick(null);
            
            TrackMenuList = menuRoot.Q(nameof(TrackMenuList));

            TrackMenuList.RegisterCallback<MouseDownEvent>(ItemParentMouseDown);
            TrackMenuList.RegisterCallback<MouseMoveEvent>(ItemParentMove);
            TrackMenuList.RegisterCallback<MouseUpEvent>(ItemParentUp);
            TrackMenuList.RegisterCallback<MouseOutEvent>(ItemParentOut);
            
            contentRoot = ActionEditorUtility.GetStyleSheet<VisualTreeAsset>(_fullMianTrackContent).Instantiate().Query()
                .ToList()[1];
            menuParent.Add(menuRoot);
            contentParent.Add(contentRoot);

            Content = contentRoot.Q(nameof(Content));
            ChildContent = contentRoot.Q(nameof(ChildContent));

            InitStyle();
            //添加数据类容
            for (int i = 0; i < data.trackDatas.Count; i++)
            {
                TrackItemData itemData = data.trackDatas[i];
                AddButtonClick(itemData);
            }
            
            FlodButton = menuRoot.Q<Button>(nameof(FlodButton));
            FlodButton.clicked += FlodButtonClick;
            FlodList();
        }

        /// <summary>
        /// 轨道折叠
        /// </summary>
        private void FlodButtonClick()
        {
            _data.isFlod = !_data.isFlod;
            FlodList();
        }

        private void FlodList()
        {
            if (_data.isFlod)
            {
                var img = EditorGUIUtility.IconContent("d_scrollright").image as Texture2D;
                FlodButton.style.backgroundImage = img;
            } 
            else
            {
                var img = EditorGUIUtility.IconContent("Dropdown").image as Texture2D;
                FlodButton.style.backgroundImage = img;
            }
            FlodElement(TrackMenuList);
            FlodElement(ChildContent);
        }

        private void FlodElement(VisualElement element)
        {
            if (_data.isFlod)
            {
                element.style.height = 0;
                element.SetEnabled(false);
                var v = element.style.visibility;
                v.value = Visibility.Hidden;
                element.style.visibility = v;
            }
            else
            {
                var height = element.style.height;
                height.keyword = StyleKeyword.Auto;
                element.style.height = height;
                element.SetEnabled(true);
                var v = element.style.visibility;
                v.value = Visibility.Visible;
                element.style.visibility = v;
            }
        }


        #region 子轨道拖动交互位置

        private bool isDragging = false;
        private int selectTrackIndex = -1;

        private void ItemParentMouseDown(MouseDownEvent evt)
        {
            //关闭旧的
            if (selectTrackIndex != -1)
            {
                _childTrackList[selectTrackIndex].UnSelect();
            }

            float mousePosition = evt.localMousePosition.y - childSize / 2;
            int trackIndex = GetChildIndexByMousePosition(mousePosition);
            selectTrackIndex = trackIndex;
            _childTrackList[trackIndex].Select();

            //todo 拖拽
            isDragging = true;
        }

        private void ItemParentMove(MouseMoveEvent evt)
        {
            if (selectTrackIndex == -1 || isDragging == false) return;
            float mousePosition = evt.localMousePosition.y - childSize / 2;
            int mouseTrackIndex = GetChildIndexByMousePosition(mousePosition);
            if (mouseTrackIndex != selectTrackIndex)
            {
                if (SwapChildPositions(selectTrackIndex, mouseTrackIndex))
                {
                    selectTrackIndex = mouseTrackIndex; //将选择的轨道更新
                }
            }
        }

        private void ItemParentUp(MouseUpEvent evt)
        {
            if (selectTrackIndex != -1)
            {
                _childTrackList[selectTrackIndex].UnSelect();
                selectTrackIndex = -1;
            }
            isDragging = false;
        }

        private void ItemParentOut(MouseOutEvent evt)
        {
            //这个函数经常会无意义调用，因为子物体的遮挡
            if (!TrackMenuList.contentRect.Contains(evt.localMousePosition)) //检测鼠标位置是否离开
            {
                if (selectTrackIndex != -1)
                {
                    _childTrackList[selectTrackIndex].UnSelect();
                    selectTrackIndex = -1;
                }
                isDragging = false;
            }
        }

        private int GetChildIndexByMousePosition(float mousePositionY)
        {
            int trackIndex = Mathf.RoundToInt(mousePositionY / childSize);
            trackIndex = Mathf.Clamp(trackIndex, 0, _childTrackList.Count - 1);
            return trackIndex;
        }

        #endregion

        protected virtual void InitStyle()
        {
            
        }

        /// <summary>
        /// 添加子轨道
        /// </summary>
        public void AddButtonClick(TrackItemData data)
        {
            if (_addChildTrackFunc == null) return;
            if (_addChildTrackFunc.Invoke())
            {
                if (data == null)
                {
                    data = DataBase.New<TrackItemData>();
                    data.name = GetType().Name + "_childTrack";
                    TUndo.RegisterCreatedObjectUndo(data, "AddChild Track");
                    TUndo.RecordObject(_data, "AddChild Track");
                    //TUndo.RecordObject(ActionEditor.Instance.ActionData, "AddChild Track");
                    _data.AddData(data);
                    AssetDatabase.AddObjectToAsset(data, _data);
                    EditorUtility.SetDirty(_data);
                    AssetDatabase.SaveAssets();
                }

                CommonChildTrackBase commonChildTrackBase = CreateChildTrack();
                commonChildTrackBase.Init(TrackMenuList, ChildContent, this, data, DeleteChildTrack);
                _childTrackList.Add(commonChildTrackBase);
                EditorUtility.SetDirty(ActionEditor.Instance.ActionData);
            }
        }

        public abstract CommonChildTrackBase CreateChildTrack();

        private void DeleteChildTrack(CommonChildTrackBase commonChildTrackBase)
        {
            if (_deleteChildTrackFunc == null) return;
            int index = commonChildTrackBase.Index;
            if (_deleteChildTrackFunc.Invoke(index))
            {
                _childTrackList.RemoveAt(index);
                commonChildTrackBase.Destory();
                
                Undo.RecordObject(_data, "DeleteChildTrack");
                //Undo.RecordObject(ActionEditor.Instance.ActionData, "DeleteChildTrack");
                TrackItemData removeData =  _data.RemoveData(index);
                DeleteTrackRemoveAllEvent(removeData);
                Undo.DestroyObjectImmediate(removeData);
                AssetDatabase.SaveAssets();
            }
        }
        
        private void DeleteTrackRemoveAllEvent(TrackItemData removeData)
        {
            TUndo.RecordObject(removeData,"DeleteChildTrack");
            for (int i = 0; i < removeData.events.Count; i++)
            {
                var eventData = removeData.events[i];
                TUndo.DestroyObjectImmediate(eventData);
            }
        }

        private bool SwapChildPositions(int index1, int index2)
        {
            if (index1 == index2) return false;

            if (index1 < index2)
            {
                (index2, index1) = (index1, index2);
            }

            if (index1 >= 0 && index2 >= 0 && index1 < TrackMenuList.childCount && index2 < TrackMenuList.childCount)
            {
                //Undo.RecordObject(ActionEditor.Instance.ActionData,"Swap Child Track");
                //交换链表元素
                CommonChildTrackBase track1 = _childTrackList[index1];
                CommonChildTrackBase track2 = _childTrackList[index2];

                if (track1._data.isReguiar || track2._data.isReguiar) return false;
                
                _childTrackList[index1] = track2;
                _childTrackList[index2] = track1;

                _data.Swap(index1, index2);
                
                //交换界面Menu元素
                VisualElement child1 = TrackMenuList[index1];
                VisualElement child2 = TrackMenuList[index2];

                TrackMenuList.RemoveAt(index1);
                TrackMenuList.RemoveAt(index2);

                TrackMenuList.Insert(index2, child1);
                TrackMenuList.Insert(index1, child2);

                //index1 += 1;
                //index2 += 1;
                //交换界面Content元素
                VisualElement trackContent1 = ChildContent[index1];
                VisualElement trackContent2 = ChildContent[index2];

                ChildContent.RemoveAt(index1);
                ChildContent.RemoveAt(index2);

                ChildContent.Insert(index2, trackContent1);
                ChildContent.Insert(index1, trackContent2);
                EditorUtility.SetDirty(ActionEditor.Instance.ActionData);
                return true;
            }
            else
            {
                Debug.LogError("提供交换子对象的索引无效。");
            }

            return false;
        }
        
        public override void TickPreView(int frameIndex)
        {
            foreach (var childTrackBase in _childTrackList)
            {
                childTrackBase.TickPreView(frameIndex);
            }
        }

        public override void DrawGizmos()
        {
            base.DrawGizmos();
            for (int i = 0; i < _childTrackList.Count; i++)
            {
                _childTrackList[i].DrawGizmos();
            }
        }

        public override void OnSceneGUI()
        {
            base.OnSceneGUI();
            for (int i = 0; i < _childTrackList.Count; i++)
            {
                _childTrackList[i].OnSceneGUI();
            }
        }

        public override void OnDestroy()
        {
            base.OnDestroy();
            for (int i = 0; i < _childTrackList.Count; i++)
            {
                _childTrackList[i].OnDestroy();
            }
        }

        /// <summary>
        /// 多行信号轨道的单个轨道
        /// </summary>
        public abstract class CommonChildTrackBase : ChildTrackBase
        {
            private const string _fullChildName = "CommonTrackMenuItem.uxml";
            private const string _trackFullName = "ChildTrackContent.uxml";

            private static Color normalColor = new Color(0, 0, 0, 0);
            private static Color selectColor = new Color(0.24f, 0.37f, 0.6f, 1);

            protected VisualElement menuRoot;
            protected VisualElement trackRoot;

            protected VisualElement menuParent;
            protected VisualElement trackParent;

            public override VisualElement trackEventContent { get; set; }
            
            protected TextField NameField;
            protected Button BtnMore;
            
            public DropdownMenuAction.Status addState = DropdownMenuAction.Status.Normal;

            //删除子轨道
            protected Action<CommonChildTrackBase> _deleteTrack;

            protected CommonTrackStyle<TrackStyle,EventStyle> _parent;
            public TrackItemData _data;

            protected List<TrackItemStyleBase> _eventItemStyleList = new List<TrackItemStyleBase>();
            
            public int Index
            {
                get
                {
                    for (int i = 0; i < menuParent.childCount; i++)
                    {
                        var item = menuParent[i];
                        if (item == menuRoot)
                        {
                            return i;
                        }
                    }

                    return -1;
                }
            }

            public virtual void Init(VisualElement menuParent, VisualElement trackParent, CommonTrackStyle<TrackStyle,EventStyle> parent ,TrackItemData data,
                Action<CommonChildTrackBase> deleteTrack)
            {
                this.menuParent = menuParent;
                this.trackParent = trackParent;
                this._deleteTrack = deleteTrack;
                this._parent = parent;
                this._data = data;
                
                menuRoot =
                    ActionEditorUtility.GetStyleSheet<VisualTreeAsset>(_fullChildName).Instantiate().Query().ToList()[1];
                this.menuParent.Add(menuRoot);

                trackRoot =
                    ActionEditorUtility.GetStyleSheet<VisualTreeAsset>(_trackFullName).Instantiate().Query().ToList()[1];
                trackEventContent = trackRoot.Q("Content");

                InitCtrlGrop();
                
                //监听移动和鼠标弹起事件
                trackEventContent.RegisterCallback<MouseUpEvent>(TrackMouseUp);
                trackEventContent.RegisterCallback<MouseMoveEvent>(TrackMouseMove);
                
                trackParent.RegisterCallback<MouseUpEvent>(TrackMouseUp);
                trackParent.RegisterCallback<MouseMoveEvent>(TrackMouseMove);
                
                trackParent.Add(trackRoot);
                
                //注册拖拽事件
                trackEventContent.RegisterCallback<DragUpdatedEvent>(OnDragUpdate);
                trackEventContent.RegisterCallback<DragExitedEvent>(DragExited);
                
                InitTrackMouseMene(trackRoot);

                BtnMore = menuRoot.Q<Button>(nameof(BtnMore));
                BtnMore.clicked += BtnMoreClick;

                //设置名字
                NameField = menuRoot.Q<TextField>(nameof(NameField));

                if (string.IsNullOrEmpty(data.trackName))
                {
                    data.trackName = NameField.value;
                }
                else
                {
                    NameField.value = data.trackName;
                }

                NameField.RegisterCallback<FocusOutEvent>(NameFieldFocusOut);

                for (int i = 0; i < _data.events.Count; i++)
                {
                    var e = _data.events[i];
                    e.OnChangeIndex = _data.Sort;
                }
                InitEvent();
            }

            #region CtrlGrop

            private string assetPath;
            protected Button Regular;
            protected Button Lock;
            protected Button View;
            protected VisualElement Mask;
            protected Label Note;
            
            private void InitCtrlGrop()
            {
                assetPath = ActionEditorUtility.GetImageRootPath();
                
                Regular = menuRoot.Q<Button>(nameof(Regular));
                Regular.clicked += RegularOnClick;
                Lock = menuRoot.Q<Button>(nameof(Lock));
                Lock.clicked += LockOnClick;
                View = menuRoot.Q<Button>(nameof(View));
                View.clicked += ViewOnClick;
                Mask = trackRoot.Q(nameof(Mask));
                Note = trackRoot.Q<Label>(nameof(Note));
                InitRegular();
                InitLock();
                InitView();
            }

            protected void InitRegular()
            {
                if (_data.isReguiar)
                {
                    var img = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath + "d_TrackMarkerButtonEnabled@2x.png");
                    Regular.style.backgroundImage = img;
                }
                else
                {
                    var img = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath + "d_TrackMarkerButtonDisabled@2x.png");
                    Regular.style.backgroundImage = img;
                }
            }
            
            protected void InitLock()
            {
                if (_data.isLock)
                {
                    var img = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath + "d_TrackLockButtonEnabled@2x.png");
                    Lock.style.backgroundImage = img;
                }
                else
                {
                    var img = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath + "d_TrackLockButtonDisabled@2x.png");
                    Lock.style.backgroundImage = img;
                }
                ModifyMask();
            }
            
            protected void InitView()
            {
                if (_data.IsDisable)
                {
                    var img = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath + "d_TrackMuteButtonEnabled@2x.png");
                    View.style.backgroundImage = img;
                }
                else
                {
                    var img = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath + "d_TrackMuteButtonDisabled@2x.png");
                    View.style.backgroundImage = img;
                }

                ModifyMask();
            }

            private void ModifyMask()
            {
                if (!_data.isLock && !_data.IsDisable)
                {
                    var display = Mask.style.display;
                    display.value = DisplayStyle.None;
                    Mask.style.display = display;
                }
                else
                {
                    var display = Mask.style.display;
                    display.value = DisplayStyle.Flex;
                    Mask.style.display = display;

                    if (_data.isLock && _data.IsDisable)
                    {
                        Note.text = "锁/禁用";
                    }
                    else if (_data.isLock)
                    {
                        Note.text = "锁";
                    }
                    else if (_data.IsDisable)
                    {
                        Note.text = "禁用";
                    }
                }
            }

            private void RegularOnClick()
            {
                _data.isReguiar = !_data.isReguiar;
                InitRegular();
            }

            private void LockOnClick()
            {
                _data.isLock = !_data.isLock;
                InitLock();
            }

            private void ViewOnClick()
            {
                _data.IsDisable = !_data.IsDisable;
                InitView();
            }

            #endregion



            /// <summary>
            /// 初始化轨道鼠标右键菜单
            /// </summary>
            protected virtual void InitTrackMouseMene(VisualElement trackParent)
            {
                // // 创建右键菜单
                // var menu = new ContextualMenuManipulator(evt =>
                // {
                //     evt.menu.AppendAction("添加元素", AddSignal, DropdownMenuAction.AlwaysEnabled);
                // });
                //
                // // 将右键菜单添加到 trackRoot 上
                // trackParent.AddManipulator(menu);
            }

            private void TrackMouseMove(MouseMoveEvent evt)
            {
                ActionEditor.Instance.MouseMoveEvent?.Invoke(evt);
            }

            private void TrackMouseUp(MouseUpEvent evt)
            {
                ActionEditor.Instance.MouseUpEvent?.Invoke(evt);
            }

            private void NameFieldFocusOut(FocusOutEvent evt)
            {
                _data.trackName = NameField.value;
            }


            /// <summary>
            /// 初始化轨道事件
            /// </summary>
            public abstract void InitEvent();
            //{
                // _eventItemStyleList = new List<SignalEventItemStyle>();
                //
                // if (_data == null || _data.events == null) return;
                //
                // for (int i = 0; i < _data.events.Count; i++)
                // {
                //     var e = _data.events[i] as SignalEvent;
                //     var eventItemStyle = new SignalEventItemStyle(this);
                //     eventItemStyle.Init(e);
                //     _eventItemStyleList.Add(eventItemStyle);
                // }
            //}

            public override void AddContent(TrackItemStyleBase itemStyle)
            {
                trackEventContent.Add(itemStyle.root);
            }

            /// <summary>
            /// 添加信号
            /// </summary>
            /// <param name="obj"></param>
            // public virtual void AddSignal(DropdownMenuAction obj)
            // {
            //     var localPositon = trackRoot.WorldToLocal(obj.eventInfo.mousePosition);
            //     int selectFrameIndex = ActionEditor.Instance.GetFrameIndexByPos(localPositon.x);
            //     //判断当前帧是否已经有信号 todo 重叠提示
            //
            //     var e = new SignalEvent(selectFrameIndex);
            //     var eventItemStyle = new SignalEventItemStyle(this);
            //     eventItemStyle.Init(e);
            //     _data.AddEvent(e);
            //     _eventItemStyleList.Add(eventItemStyle);
            // }

            public override void DeleteEvent(TrackItemStyleBase itemStyle)
            {
                _eventItemStyleList.Remove(itemStyle);
                trackEventContent.Remove(itemStyle.root);
                //TUndo.RecordObject(ActionEditor.Instance.ActionData,"Delete Event");                
                TUndo.RecordObject(_data, "RemoveEvent " + itemStyle.eventData.GetType());
                _data.RemoveEvent(itemStyle.eventData);
                TUndo.DestroyObjectImmediate(itemStyle.eventData);
                EditorUtility.SetDirty(_data);
                //EditorUtility.SetDirty(ActionEditor.Instance.ActionData);
                
                AssetDatabase.SaveAssets();
            }


            /// <summary>
            /// 更多菜单功能
            /// </summary>
            private void BtnMoreClick()
            {
                var menu = new GenericMenu();
                menu.AddItem(new GUIContent("删除"), false, OnDelete);
                menu.AddItem(new GUIContent("拷贝"), false, OnCopy);
                menu.ShowAsContext();
            }

            private void OnCopy()
            {
                var cloneData = _data.Clone() as TrackItemData;
                TUndo.RecordObject(_parent._data, "Copy Child Track");
                TUndo.RegisterCreatedObjectUndo(cloneData, "Copy Child Track");
                AssetDatabase.AddObjectToAsset(cloneData, _parent._data);
                EditorUtility.SetDirty(_parent._data);
                AssetDatabase.SaveAssets();
                for (int i = 0; i < cloneData.events.Count; i++)
                {
                    var eventData = cloneData.events[i];
                    TUndo.RegisterCreatedObjectUndo(eventData, "Copy Child Track");
                    AssetDatabase.AddObjectToAsset(eventData, cloneData);
                } 
 
                EditorUtility.SetDirty(cloneData);
                _parent._data.AddData(cloneData);
                EditorUtility.SetDirty(_parent._data);
                ActionEditor.Instance.RefreshWindow();
            }

            private void OnDelete()
            {
                _deleteTrack?.Invoke(this);
            }

            public void Select()
            {
                menuRoot.style.backgroundColor = selectColor;
            }

            public void UnSelect()
            {
                menuRoot.style.backgroundColor = normalColor;
            }


            public void Destory()
            {
                menuParent.Remove(menuRoot);
                trackParent.Remove(trackRoot);
                OnDestroy();
                //todo trackRoot的删除
            }
            
            #region 拖拽资源

            private void OnDragUpdate(DragUpdatedEvent evt)
            {
                // 监听用户拖拽的是否是动画
                UnityEngine.Object[] objs = DragAndDrop.objectReferences;
                Object obj = objs[0] as Object;
                if (obj != null)
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
                }
            }

            private void DragExited(DragExitedEvent evt)
            {
                // 监听用户拖拽的是否是动画
                UnityEngine.Object[] objs = DragAndDrop.objectReferences;
                Object obj = objs[0] as Object;
                if (obj != null)
                {
                    int selectFrameIndex = ActionEditor.Instance.GetFrameIndexByPos(evt.localMousePosition.x);
                    DragObjCreateEvent(obj, selectFrameIndex);
                }
            }

            protected virtual void DragObjCreateEvent(Object obj, int selectFrameIndex)
            {
                
            }

            #endregion
            
            public virtual void TickPreView(int frameIndex)
            {
                if (_data.IsDisable) return;
                for (int i = 0; i < _eventItemStyleList.Count; i++)
                {
                    var eventItem = _eventItemStyleList[i];
                    eventItem.TickPreView(frameIndex);
                    if (eventItem.IsHit(frameIndex))
                    {
                        eventItem.HitEventPreView(frameIndex);
                        if (ActionEditor.Instance.IsRecordEvent) eventItem.RecordEvent(frameIndex);
                    }
                }
            }

            public virtual void DrawGizmos()
            {
                if(_data.IsDisable) return;
                for (int i = 0; i < _eventItemStyleList.Count; i++)
                {
                    _eventItemStyleList[i].DrawGizmos();
                } 
            }
            
            public virtual void OnSceneGUI()
            {
                if(_data.IsDisable) return;
                for (int i = 0; i < _eventItemStyleList.Count; i++)
                {
                    _eventItemStyleList[i].OnSceneGUI();
                }
            }

            public virtual void OnDestroy()
            {
                for (int i = 0; i < _eventItemStyleList.Count; i++)
                {
                    _eventItemStyleList[i].OnDestroy();
                }
            }
            
        }

    }

    public abstract class ChildTrackBase
    {
        public abstract VisualElement trackEventContent { get; set; }
        
        public abstract void AddContent(TrackItemStyleBase itemStyle);

        public abstract void DeleteEvent(TrackItemStyleBase itemStyle);
    }
}
